<!DOCTYPE html>
<html>
<head>
        <meta charset="utf-8">
        <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
        <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
        <title>服务器地址和线号</title>
        <link rel="stylesheet" type="text/css" href="../../css/api.css" />
        <link rel="stylesheet" type="text/css" href="../../css/style.css" />
        <link rel="stylesheet" type="text/css" href="../../css/weui.min.css">
        <script type="text/javascript" src="../../script/jquery-1.10.2.min.js"></script>
</head>
<body>
	 <div id="wrap" class="flex-wrap flex-vertical" >
        <header class="border-b" >
            <b tapmode="hover" onclick="api.closeWin();" class="ic-back"></b>
            <div class="title"></div>
            <b tapmode="hover" onclick="funActionSheet();"  class="ic-check"></b>
        </header>
         <div class="container" id="container">
            <div class="weui_cells weui_cells_form">
                <div class="weui_cell">
                    <div class="weui_cell_hd"><label class="weui_label">写入地址</label></div>
                    <div class="weui_cell_bd weui_cell_primary">
                        <input class="weui_input" name="txtServerURLWrite" id="txtServerURLWrite"  placeholder="写入地址" value="http://192.168.2.254:11588" /> 
                    </div>
                    <div class="weui_cell_ft">
                        <i class="weui_icon_warn"></i>
                    </div>
                </div>
                <div class="weui_cell">
                    <div class="weui_cell_hd"><label class="weui_label">读取地址</label></div>
                    <div class="weui_cell_bd weui_cell_primary">
                        <input class="weui_input" name="txtServerURLRead" id="txtServerURLRead"  placeholder="读取地址" value="http://192.168.2.254:11589" /> 
                    </div>
                    <div class="weui_cell_ft">
                        <i class="weui_icon_warn"></i>
                    </div>
                </div>
                <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">检测线代号</label></div>
                    <div class="weui_cell_bd weui_cell_primary">
                        <select class="select" style="width: 200px" id="selectLineNum">
                            <option selected="selected" value="1">1</option>
                            <option value="2">2</option>
                            <option value="3">3</option>
                            <option value="4">4</option>
                            <option value="5">5</option>
                            <option value="6">6</option>
                            <option value="7">7</option>
                            <option value="8">8</option>
                            <option value="9">9</option>
                            <option value="10">10</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="weui_cells_tips" id="divAlert"><span id="spAlert" class="fontRed"></span></div>
            <div class="space"></div>
            <div class="mainbutton">
                <a class="weui_btn weui_btn_primary" href="javascript:;" id="btnLogin" onclick="SaveInfo()"> 确 定 </a>
            </div>
            <div class="space"></div>
        </div>
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript">
    apiready = function(){
        var vGetNewUrlWrite = $api.getStorage('ServerUrlWrite');
        var vGetNewUrlRead = $api.getStorage('ServerUrlRead');
        var vLineNum = $api.getStorage('LineNum');

        if(vGetNewUrlWrite != null)
        {
            $("#txtServerURLWrite").val(vGetNewUrlWrite);
        }

        if(vGetNewUrlRead != null)
        {
            $("#txtServerURLRead").val(vGetNewUrlRead);
        }
         if(vLineNum != null)
        {
            $("#selectLineNum").val(vLineNum);
        }
    };

	function SaveInfo()
	{
        var vUrl_Write = $("#txtServerURLWrite").val();
        var vUrl_Read = $("#txtServerURLRead").val();
        var vlineNum = $("#selectLineNum").val();
        $api.setStorage('ServerUrlWrite', vUrl_Write);
        $api.setStorage('ServerUrlRead', vUrl_Read);
        $api.setStorage('LineNum', vlineNum);
        OpenIndex();
	}

	function OpenIndex() {
		api.closeWin({
			name: 'win_setup',
            url: 'win_setup.html',
		});

        api.openWin({
            name: 'index',
            url: '../../index.html',
            bounces: false,
            reload:true,
            delay: 200
        });
    }
</script>
</html>